package com.joysuch.wwyt.risk.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import static javax.persistence.GenerationType.IDENTITY;

@Data
@EntityListeners({AuditingEntityListener.class, AutoSetCommonFieldListener.class})
@Entity
@Table(name = "wwyt_risk_point_business_evaluation")
@SQLDelete(sql = "update wwyt_risk_point_business_evaluation set DELETE_FLAG = '1' where id= ?")
@SQLDeleteAll(sql = "update wwyt_risk_point_business_evaluation set DELETE_FLAG = '1' where id= ?")
@Where(clause = "DELETE_FLAG = '0'")
public class RiskPointEvaluationBusiness implements Serializable {

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @ApiModelProperty("风险点控制风险评价id")
    private Long id;

    @ApiModelProperty("风险点id")
    private Long pointId;

    @ApiModelProperty("0风险点固有风险评价,1风险点控制风险评价")
    private Integer pointAnalyzeType;

    @ApiModelProperty("分析方法id")
    private Long analyzeWayId;

    @ApiModelProperty("风险等级")
    private Integer riskLevel;

    @ApiModelProperty("评估人员id")
    private String evaluationUserIds;

    @ApiModelProperty("受控号")
    private String controlNumber;

    @ApiModelProperty("评估日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date evaluationDate;

    @ApiModelProperty("风险点类别:null风险点;1风险点库")
    private Integer shared;

    @ApiModelProperty("复评时：是否是引用评估 0=否 (保存并更新分析库)，1=是（保存当前）")
    private Integer refEval;

    @ApiModelProperty("关联的固有评估id")
    private Long stableEvaluationId;


    //通用字段
    @ApiModelProperty("创建人")
    @org.springframework.data.annotation.CreatedBy
    private Long createBy;

    @ApiModelProperty("创建时间")
    @org.springframework.data.annotation.CreatedDate
    private java.time.LocalDateTime createTime;

    @ApiModelProperty("更新人")
    @org.springframework.data.annotation.LastModifiedBy
    private Long updateBy;

    @ApiModelProperty("更新时间")
    @org.springframework.data.annotation.LastModifiedDate
    private java.time.LocalDateTime updateTime;

    @ApiModelProperty("租户")
    private Long tenentId;

    @ApiModelProperty("组织机构代码")
    private String orgCode;

    @ApiModelProperty("删除标记")
    private String deleteFlag;
}
